package edu.sctu.xiangkun.day201506.day20150617;

import java.io.*;

/**
 * Created by user04 on 2015/6/17.
 */
public class DemoFour {
    public void getLineWriter(){
        try{
            File file1 = new File("D://hc.txt");
            FileReader fileReader = new FileReader(file1);
            FileWriter fileWriter = new FileWriter(new File("D://hc3.txt"));
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
            while(bufferedReader.ready()){
               String str =  bufferedReader.readLine();
                System.out.println("每行的内容："+str);
                bufferedWriter.write(str);
                bufferedWriter.newLine();
            }

            try{
                bufferedReader.close();
                bufferedWriter.close();
            }catch(IOException e){
                e.printStackTrace();
            }

        }catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
